package com.dreamchaser.familydevice.util.QYWeChat;


import com.dreamchaser.familydevice.util.QYWeChat.BaseModel.ResponseModelByWeChat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 微信工具
 */
@Component
public class WeChatUtil {
    /**
     * 应用标识和id
     */
    public static Map<Integer, String> application = new HashMap<Integer, String>();
    /**
     * 旺旺
     */
    public static Integer wwAgentId = 1000002;
    /**
     * 统一异常处理bug
     */
    public static Integer bugAgentId = 1000003;
    /**
     * 黄翔湾餐饮
     */
    public static Integer hxwAgentId = 1000005;
    /**
     * 数据财务
     */
    public static Integer familyDataAgentId = 1000007;

    @Autowired
    AgentMsgUtil agentMsgUtil;

    /**
     * 发送应用消息
     *
     * @param toUsers
     * @param agentId 应用id
     * @return
     */
    public ResponseModelByWeChat sendAgentMsg(String toUsers, Integer agentId, String content) {
        return agentMsgUtil.sendMessage(toUsers, application.get(agentId), agentId, content);
    }

    public WeChatUtil() {
        //统一异常处理bug
        application.put(1000003, "hgEw4LspGHIB9p2ttPYn8bF2zqoYZehQm7VrxAPH1AM");
        //旺旺应用标识
        application.put(1000002, "7Rd2QGXmnEuZ28PnDnkzXGMQgOOspX6N3gD69O4a7FQ");

        //黄祥湾餐饮系统
        application.put(1000005, "MNCoBFtBr8RII8o4BGeqMyh5i_DrgoXMWB4S2PRhbs0");
        application.put(1000007, "7pFnNkOdUhTPX8ky60ZQECw4NEqbXBzPxR0dGQb-nTE");
    }
}
